using System;
using LightPersist.Metainfo;

namespace LightPersist
{
	internal class PersistentDatabaseConfiguration : ModelBase
	{
		static PersistentDatabaseConfiguration()
		{
			LightPersistContext.RegisterFactory<PersistentDatabaseConfiguration>(ctx => new PersistentDatabaseConfiguration(ctx));
			Metainfo.PropertiesDeclared.Add(new PropertyMetainfo
			{
				Name = "RootObjectId",
				Type = typeof(Guid).FullName,
				TypeClrPersist = typeof(Guid),
			});
//			Metainfo.Properties.Add(new PropertyMetainfo
//			{
//				Name = "NewObjectsHolder",
//				IsList = true,
//				Type = typeof(ModelBase).FullName,
//			});
		}

//		internal ILightListProxy<ModelBase> NewObjectsHolder
//		{
//			get { return GetList<ModelBase>("NewObjectsHolder"); }
//		}

		public PersistentDatabaseConfiguration(LightPersistContext ctx) : base(ctx)
		{
		}

		public Guid RootObjectId
		{
			get
			{
				return GetValue<Guid>("RootObjectId");
			}
			set
			{
				SetValue<Guid>(value, "RootObjectId");
			}
		}

		new internal readonly static ClassMetainfo Metainfo = new ClassMetainfo
																					{
																						Name = DomainMetainfo.PersistentDatabaseConfigurationAqn,
																						TypeClrPersist = typeof(PersistentDatabaseConfiguration),

																					};
	}
}